﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="KnowledgeBase.aspx.cs" Inherits="PMP.Documentation.KnowledgeBase" ValidateRequest="false" %>

<%@ Register assembly="FreeTextBox" namespace="FreeTextBoxControls" tagprefix="FTB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Knowledge Base</title>
    <style type="text/css">
        .style1
        {
            width: 80%;
        }
        .style2
        {
            width: 199px;
        }
        .style3
        {
            width: 196px;
        }
        .style4
        {
            color: #FF0000;
        }
        .style5
        {
            width: 37px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="lblMsg" runat="server" ForeColor="Red"></asp:Label>
        <table class="style1">
            <tr>
                <td style="text-align: right">
                    Author:</td>
                <td>
                    <asp:DropDownList ID="ddlAuthors" runat="server" Height="22px" Width="196px" DataTextField="name" DataValueField="id"
                        DataSourceID="SqlDataSourceResources"  AutoPostBack="True" >
                        <asp:ListItem></asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td style="text-align: right">
                    Type</td>
                <td>
                    <asp:DropDownList ID="ddlType" runat="server" Height="22px" Width="196px" 
                        onselectedindexchanged="ddlType_SelectedIndexChanged"  AutoPostBack="True" >
                        <asp:ListItem></asp:ListItem>
                        <asp:ListItem>Issue</asp:ListItem>
                        <asp:ListItem>Knowledge</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td class="style5" style="text-align: right">
                    Label:</td>
                <td class="style2">
                    <asp:TextBox ID="txtLabel" runat="server" Width="196px"></asp:TextBox>
                </td>
                <td class="style3">
                    (<span class="style4">Label will be seperated with &#39;;&#39;</span>)</td>
                <td>
                    &nbsp;</td>
                <td>
                 </td>
            </tr>
            <tr>
                <td style="text-align: right">
                    <asp:Label ID="lblTitle" runat="server" Text="Title:"></asp:Label>
                    </td>
                <td colspan="6">
                    <asp:TextBox ID="txtTitle" runat="server" Width="869px" AutoPostBack="True" 
                        ontextchanged="txtTitle_TextChanged"></asp:TextBox>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td style="text-align: right">
                    <asp:Label ID="lblIssue" runat="server" Text="Issue:" Visible="false"></asp:Label>
                    </td>
                <td colspan="6">
                    <asp:TextBox ID="txtIssue" runat="server" Width="869px" Visible="false"></asp:TextBox>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td colspan="7">
    <FTB:FreeTextBox ID="ftbResolution" runat="server" Width="100%">
    </FTB:FreeTextBox>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td colspan="8">
                    <asp:Button ID="btnAdd" runat="server" Text="Add/Update" onclick="btnAdd_Click" />
                    <asp:Button ID="btnClear" runat="server" Text="Clear Criteria" onclick="btnClear_Click" />
                    <asp:Button ID="btnSeach" runat="server" Text="Seach" 
                        onclick="btnSeach_Click" />
                &nbsp;(If necessary, please put keywords seperated by space into title or issue.)</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    
    </div>
    
    
    
    
    <asp:GridView ID="grvKnowledgeBase" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="ID" OnRowCommand="grvKnowledgeBase_RowCommand"
        CellPadding="4" ForeColor="#333333" GridLines="None">
        <RowStyle BackColor="#EFF3FB" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSourceKnowledgeBase" runat="server" 
        ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>" 
        SelectCommand="SELECT [type], [title], [issue], [resolution], [label], usr.usr_name [author], knowledgebase.ID FROM [KnowledgeBase] join usr on (usr.id = KnowledgeBase.author) ORDER BY [type], [title]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSourceResources" runat="server" 
        ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>" 
        SelectCommand="select top 1 '' name, '' id from usr union SELECT usr_name name, id from usr order by name ">
    </asp:SqlDataSource>
    <asp:TextBox ID="txtID" Visible="false" runat="server"></asp:TextBox>
    </form>
</body>
</html>
